package com.service.impl;


import com.dao.EmpDao;
import com.service.EmpService;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Service
//@Scope("prototype")
public class EmpServiceImpl implements EmpService {

    public EmpServiceImpl() {
        System.out.println("service 构造函数---");

    }

    private EmpDao dao;

    public EmpDao getDao() {
        return dao;
    }

    public void setDao(EmpDao dao) {
        this.dao = dao;
    }

    @Override
    public void insert() {
        System.out.println("com.service emp");
        dao.insert();
    }

    @PostConstruct //post在之后 construct构造 等价于init-method
    public void init() {
        System.out.println("init in service");
    }

    @PreDestroy //pre在之前 等价于destroy-method
    public void destroy() {
        System.out.println("destroy in service---");
    }
}
